clear; clc; getSession;
%%
zs = sess.getZIServer;
spect = zs.spectrumModule('spect');
%%
spect.initialize();
spect.setFrequencyGrid(1024);
spect.setAverage(100);
spect.subscribe('dev3543', ziDemod1.X_fft_abs_avg, [2 2 1]);
spect.subscribe('dev3543', ziDemod1.R_fft_abs_avg, [2 2 2]);
spect.subscribe('dev3560', ziPID3.Error_fft_abs_avg, [2 2 3]);
res=spect.run();
spect.unsubscribe();
res.plot_data('dev3543', ziDemod1.X_fft_abs_avg)
%%
spect.initialize();
spect.setAverage(100);
spect.setFrequencyGrid(1024, 'mode', ziEnumGridMode.Exact);
spect.subscribe('dev3543', ziDemod1.X_fft_abs_avg);
spect.subscribe('dev3543', ziDemod1.DIO_fft_abs_avg);
spect.subscribe('dev3560', ziPID3.Error_fft_abs_avg);
spect.setTrigger('dev3543', ziDemod1.TrigIn1, 'edge', ziEnumTrigEdgeSlope.Both, 'level', 0.5);
res=spect.run();